package com.xmut.rc.common.utils;

import cn.hutool.extra.mail.MailAccount;
import cn.hutool.extra.mail.MailUtil;

/**
 * @author XS
 * @Version v1.0
 * @ClassName: EmailUtil
 * @Description:
 * @Date: 2022/5/20 15:12
 */
public class EmailUtil {
    static MailAccount account = new MailAccount();

    static {
        //此处填写SMTP服务器
        account.setHost("smtp.qq.com");
        //端口号，QQ邮箱给出了两个端口，这里给出587
        account.setPort(587);
        //表示SMTP发送邮件，必须进行身份验证
        account.setAuth(true);
        //此处填写你的账号
        account.setFrom("1401642560@qq.com");
        account.setUser("1401642560@qq.com");
        account.setPass("laulksxwwdclgbij");
    }

    public static void sendEmail(String targetEmail, String title, String content) {
        MailUtil.send(account, targetEmail, title, content, false);
    }
}
